Skip to content

Fix python-fastapi signature of parameters for method#18691

Closed
diorcety wants to merge 1 commit into
OpenAPITools:masterfrom
diorcety:fix_fastapi
Closed

Fix python-fastapi signature of parameters for method#18691
diorcety wants to merge 1 commit into
OpenAPITools:masterfrom
diorcety:fix_fastapi

Conversation

@diorcety
Copy link
Copy Markdown
Contributor

If the parameter type is an map or a list an invalid python was producted, for example:

body: = Body(None, description=""),

This PR use function postProcessOperationsWithModels of AbstracPythonCodegen in order to use vendorExtensions.x-py-typing

null
);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR.

cc @cbornet (2017/09) @tomplus (2018/10) @krjakbrjak (2023/02) @fa0311 (2023/10) @multani (2023/10)

@multani
Copy link
Copy Markdown
Contributor

multani commented May 20, 2024

@diorcety do you have a test that you could add to show the problem and how your change fixes it?

@diorcety
Copy link
Copy Markdown
Contributor Author

An integrated test? no for the moment, but a json file yes, the one from grafana: https://github.com/grafana/grafana/blob/main/public/openapi3.json

@wing328
Copy link
Copy Markdown
Member

wing328 commented May 26, 2024

@diorcety can you please update the test spec modules/openapi-generator/src/test/resources/3_0/python-fastapi/petstore.yaml with a test or 2 and update the samples so that the CI can verify the change?

@diorcety
Copy link
Copy Markdown
Contributor Author

diorcety commented Jun 3, 2024

@diorcety can you please update the test spec modules/openapi-generator/src/test/resources/3_0/python-fastapi/petstore.yaml with a test or 2 and update the samples so that the CI can verify the change?

Done. The example comes from grafana API. The issue is really related to "lazy" body definition which is solved by using the same function that client generator

@wing328 wing328 modified the milestones: 7.7.0, 7.8.0 Jul 2, 2024
@wing328 wing328 modified the milestones: 7.8.0, 8.0.0 Aug 18, 2024
@wing328
Copy link
Copy Markdown
Member

wing328 commented Oct 10, 2024

I've filed #19830 and limited the change only to python fastapi (as python client generators do not use the responses at the moment)

@wing328
Copy link
Copy Markdown
Member

wing328 commented Oct 10, 2024

closed via #19830

thanks for the contribution

@wing328 wing328 closed this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants